home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / Internal_43_ActionHandler- button 2 picts.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  1.4 KB  |  57 lines

  1. property UpCM, DownCM, button_active, UpNum, DownNum, ActionHandler
  2.  
  3. on getPropertyDescriptionList
  4.   set description to [:]
  5.   addProp(description, #DownCM, [#default: "Down", #format: #bitmap, #comment: "Pict for Down:"])
  6.   addProp(description, #ActionHandler, [#default: "nothing", #format: #string, #comment: "Handler to execute:"])
  7.   return description
  8. end
  9.  
  10. on getBehaviorDescription
  11.   return "Button, auto set up pict, switch pict down"
  12. end
  13.  
  14. on getAssocMembers
  15.   set myPropList to [DownCM]
  16.   return myPropList
  17. end
  18.  
  19. on beginSprite me
  20.   set the UpCM of me to the member of sprite the spriteNum of me
  21.   set the UpNum of me to the number of member UpCM
  22.   set the DownNum of me to the number of member DownCM
  23.   set the button_active of me to 0
  24.   puppetSprite(the spriteNum of me, 1)
  25. end
  26.  
  27. on endSprite me
  28.   puppetSprite(the spriteNum of me, 0)
  29. end
  30.  
  31. on mouseDown me
  32.   set the member of sprite the spriteNum of me to DownNum
  33.   set the button_active of me to 1
  34. end
  35.  
  36. on mouseUp me
  37.   set the member of sprite the spriteNum of me to UpNum
  38.   set the button_active of me to 0
  39.   do(ActionHandler)
  40. end
  41.  
  42. on mouseUpOutSide me
  43.   set the button_active of me to 0
  44. end
  45.  
  46. on mouseLeave me
  47.   if the button_active of me then
  48.     set the member of sprite the spriteNum of me to UpNum
  49.   end if
  50. end
  51.  
  52. on mouseEnter me
  53.   if the button_active of me then
  54.     set the member of sprite the spriteNum of me to DownNum
  55.   end if
  56. end
  57.